package com.moli.iov.producer;

import org.apache.kafka.clients.producer.RecordMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.support.ProducerListener;

public class kafkaProducerListener implements ProducerListener {

    protected final Logger logger=LoggerFactory.getLogger("kafkaProducerListener");

    @Override
    public void onSuccess(String topic, Integer partition, Object key, Object value, RecordMetadata recordMetadata) {
      // logger.info("==========kafka发送数据"+"--topic:"+topic+"--key:"+key+"--value:"+value+"成功==========");
    }

    @Override
    public void onError(String topic, Integer partition, Object key, Object value, Exception e) {
        logger.error("==========kafka发送数据失败--topic: {}---partition{} --key: {} --value:{}", topic,partition, key, value, e);
    }

    @Override
    public boolean isInterestedInSuccess() {
        //logger.info("///kafkaProducer监听器启动///");
        return true;
    }
}
